<script setup>
import Menu from './components/menu.vue'
import Header from './components/header.vue'
import TagList from './components/tag-list.vue'
import useUserStore from '@/store/user'
import { storeToRefs } from 'pinia'

//菜单收缩
const userStore = useUserStore()
const { isMenu } = storeToRefs(userStore)
</script>

<template>
  <el-container>
    <el-aside :width="isMenu ? '60px' : '250px'">
      <Menu></Menu>
    </el-aside>
    <el-container>
      <el-header class="header">
        <Header></Header>
      </el-header>
      <TagList></TagList>
      <el-main>
        <!-- 页面组件缓存，最大可存储10个 -->
        <RouterView v-slot="{ Component }">
          <KeepAlive :max="10">
            <component :is="Component"></component>
          </KeepAlive>
        </RouterView>
      </el-main>
    </el-container>
  </el-container>
</template>

<style scoped>
.el-container {
  height: 100%;
}
.el-header {
  padding: 0;
  height: 50px;
}

.el-header {
  padding: 0 !important;
}

.el-aside {
  overflow-x: hidden;
  overflow-y: auto;
  line-height: 200px;
  text-align: left;
  background-color: #001529;
  transition: width 0.5s ease;
  scrollbar-width: none;
  /* firefox */
  -ms-overflow-style: none;
  /* IE 10+ */
}

.el-aside::-webkit-scrollbar {
  display: none;
}

.el-main {
  background-color: #f0f2f5;
  padding: 0 10px !important;
}
</style>
